package com.huanying.goodjob.appraise;

import java.util.Date;
import java.util.HashSet;
import java.util.Set;
import java.util.List;


import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Table;

import com.huanying.framework.user.User;
import com.huanying.goodjob.job.Jobitem;
import com.huanying.goodjob.skill.Skill;

@Entity
@Table(name = "appraise")
public class Appraise {
	private static final long serialVersionUID = -8714406550574846572L;

	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	private int id;//评价编号
	@ManyToOne(fetch=FetchType.EAGER)
	@JoinColumn(name = "appraiser_id")
    private User appraiser;//评价者
	@ManyToOne(fetch=FetchType.EAGER)
	@JoinColumn(name = "appraiseobject_id")
	private User appraiseobject;//被评价者
	private int direction;//评价方向：1 工长评工人  2工人评工长
	@OneToOne(cascade = CascadeType.REFRESH, optional = true)
	@JoinColumn(name = "jobitem_id")
	private Jobitem jobitem;//评价的工作项
	@OneToMany(cascade = { CascadeType.REFRESH, CascadeType.PERSIST, CascadeType.MERGE,
			CascadeType.REMOVE }, mappedBy = "appraise", fetch = FetchType.EAGER)
    private transient List<Label> labels;// 对应的标签集合  

	private String context;//评价内容
	private Date create_time;//创建时间
	@Column(name = "appraise_score", nullable = false, columnDefinition = "INT default 2")
	private int appraise_score;//评价积分
	@Column(name = "status", nullable = false, columnDefinition = "INT default 1")
	private int status;//状态：0禁用 1可用
	
	
	public void setCreate_time(Date create_time) {
		this.create_time = create_time;
	}
	public User getAppraiseobject() {
		return appraiseobject;
	}
	public void setAppraiseobject(User appraiseobject) {
		this.appraiseobject = appraiseobject;
	}
	
	public int getDirection() {
		return direction;
	}
	public void setDirection(int direction) {
		this.direction = direction;
	}
	public int getId() {
		return id;
	}
	public void setId(int id) {
		this.id = id;
	}
	public User getAppraiser() {
		return appraiser;
	}
	public void setAppraiser(User appraiser) {
		this.appraiser = appraiser;
	}
	public Jobitem getJobitem() {
		return jobitem;
	}
	public void setJobitem(Jobitem jobitem) {
		this.jobitem = jobitem;
	}
	
	public List<Label> getLabels() {
		return labels;
	}
	public void setLabels(List<Label> labels) {
		this.labels = labels;
	}
	public String getContext() {
		return context;
	}
	public void setContext(String context) {
		this.context = context;
	}
	public Date getCreate_time() {
		return create_time;
	}
	
	public int getAppraise_score() {
		return appraise_score;
	}
	public void setAppraise_score(int appraise_score) {
		this.appraise_score = appraise_score;
	}
	public int getStatus() {
		return status;
	}
	public void setStatus(int status) {
		this.status = status;
	}
	public static long getSerialversionuid() {
		return serialVersionUID;
	}
}
